﻿using Coldairarrow.Business.BackStage.ConsumeChats;
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.Entity.BackStage.ConsumeChats;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Api.Controllers.BackStage.ConsumeChats
{
    [Route("/BackStage/ConsumeChats/[controller]/[action]")]
    public class ConsumeServerController : BaseApiController
    {
        #region DI

        public ConsumeServerController(IConsumeServerBusiness consumeServerBus)
        {
            _consumeServerBus = consumeServerBus;
        }

        IConsumeServerBusiness _consumeServerBus { get; }

        #endregion

        #region 获取
        /// <summary>
        /// 后台——获取用户列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageResult<Base_UserDTO>> GetUserDataList(PageInput<GetUsersInputDTO> input)
        {
            return await _consumeServerBus.GetUserDataListAsync(input);
        }
        /// <summary>
        /// 后台——获取客服自己名称和头像
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<SetServerInfoDTO> GetTheData(IdInputDTO id)
        {
            return await _consumeServerBus.GetTheUserDataAsync(id);
        }

        /// <summary>
        /// 后台——获取客服自己名称和头像
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<SetServerInfoDTO> GetCServerInfo()
        {
            return await _consumeServerBus.GetCServerInfoAsync();
        }
        #endregion

        #region 提交
        /// <summary>
        /// 后台——设置用户为客服
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task SetUserToCServer(SetServiceInputDTO input)
        {
           
            await _consumeServerBus.SetUserToCustomrtServer(input.Id,input.ClassId);
        }

        /// <summary>
        /// 后台——取消用户为客服
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task DeleteUserToCServer(IdInputDTO input)
        {

            await _consumeServerBus.DeleteUserToCustomrtServer(input.Id);
        }

        /// <summary>
        /// 后台——客服设置自己名称和头像
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task SetServerInfo(SetServerInfoDTO input)
        {
            await _consumeServerBus.SetServerInfoAsync(input);
        }
        #endregion
    }
}